<%@ page language="java" import="java.util.*,shop.dao.*,shop.entity.*" 	pageEncoding="utf-8"%>
<%@ page import="myservlet.OnlineCounter" %> 
<!DOCTYPE HTML>
<html>
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
  <meta charset="UTF-8">

  <meta name="description" content="">
  <meta name="keywords" content="">

  <title>个人信息</title>

  <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
  <link href="css/style.css" media="screen" rel="stylesheet" type="text/css">
  <link href="css/grid.css" media="screen" rel="stylesheet" type="text/css">

  <script src="js/jquery-1.7.2.min.js" ></script>
  <script src="js/html5.js" ></script>
  <script src="js/jflow.plus.js" ></script>
  <script src="js/jquery.carouFredSel-5.2.2-packed.js"></script>
  <script src="js/checkbox.js"></script>
  <script src="js/radio.js"></script>
  <script src="js/selectBox.js"></script>


  <%
     //检验是否已经登录
	String username=(String)session.getAttribute("username");
	String userSession=(String)session.getAttribute("userSession");
    String userID=(String)session.getAttribute("userID");
	if(username=="" || username==null || userID=="" || userID==null)
	{
		out.println("<script language='javascript'>alert('请先登录!');window.location.href='../login.jsp';</script>");
	}
	else
	{


    //数据库连接 
    
	ProductDao pt = new ProductDao();	
	TypeDao pt1 = new TypeDao();
	List pl2 = pt1.findmain_type();
	//个人资料查询
	CustomerDao CD = new CustomerDao();
	Customer CDP = CD.findcustomerBYID(userID);
	//订单查询
	OrdersDao OD = new OrdersDao();
	 List orderList = (List) OD.fineOrderBYUSER(CDP.getC_name());
	%>
	<!-- 数据库连接 -->
</head>
<body>
  <div class="container_12">
    <div id="top">
      <div class="grid_3">
        <div class="phone_top">
          Call CN +110
        </div><!-- .phone_top -->
      </div><!-- .grid_3 -->

      <div class="grid_6">
        <div class="welcome">
   <% if(session.getAttribute("userSession")!=null){%>
        上次登录的时间:<%=session.getAttribute("lasttime") %>
   &nbsp;&nbsp;&nbsp;当前在线人数:<%=OnlineCounter.getOnline()%>
         <%}  %>
        </div><!-- .welcome -->
      </div><!-- .grid_6 -->

      <div class="grid_3">
        
      </div><!-- .grid_3 -->
    </div><!-- #top -->

    <div class="clear"></div>

    <header id="branding">
      <div class="grid_3">
        <hgroup>
          <h1 id="site_logo" ><a href="index.jsp" title=""><img height="119.8" width="130.8" src="images/login.jpg" alt="Online Store Theme Logo"/></a></h1>
          <h2 id="site_description">年轻人的第一个游戏网</h2>
        </hgroup>
      </div><!-- .grid_3 -->

      <div class="grid_3">
        <form class="search" action="catalog_search.jsp" method="post">
          <input type="text" name="search" class="entry_form" value="" placeholder="寻找游戏"/>&nbsp;
	</form>
      </div><!-- .grid_3 -->

      <div class="grid_6">
        <ul id="cart_nav">
          <li>
            <a class="cart_li" href="shop_cart.jsp"><span>购物车</span></a>
              </li>
            </ul>

        <nav class="private">
          <ul>
       <% if(session.getAttribute("userSession")==null){%> 
            <li><a href="login.jsp">登录</a></li>
            <li class="separator">|</li>
            <li><a href="Create user.jsp">注册</a></li>
        <%}else{  %>
       <li><a href="##.jsp">用户(<%=session.getAttribute("username") %>)身份(<%=session.getAttribute("userSession")%>)</a>
        <li class="separator">|</li>
       <% if(session.getAttribute("userSession").equals("管理员") ){ %><li><a href="admin/ht.jsp"><span>后台</span></a></li><% } %>
       <% if(session.getAttribute("userSession").equals("客户") ){ %><li><a href="Personal.jsp"><span>个人信息</span></a></li><% } %>
       <li class="separator">|</li>
       <li> <a href="deal/logout.jsp" >[注销]</a></li>
			    <%}  %>
          </ul>
        </nav><!-- .private -->
      </div><!-- .grid_6 -->
    </header><!-- #branding -->
  </div>

  <div class="clear"></div>

  <div id="block_nav_primary">
    <div class="container_12">
      <div class="grid_12">
        <nav class="primary">
          <ul>
            <li class="curent"><a href="index.jsp">首页</a></li>
                        <li><a href="blog_post.jsp">新闻</a></li>
                        <li><a href="catalog_grid.jsp">类型</a></li>
<%
	if (pl2.size() > 0) {
		for (int i = 0; i < pl2.size(); i++) {
			main_type pd2 = (main_type) pl2.get(i);			
%>
                <li><span><a href="catalog_grid.jsp?type=<%=pd2.getT_id()%>"><%=pd2.getT_type() %></a></span></li>
				<%}%>
				<%}else{ %>
                <li><span><a href="#">没有产品区</a></span></li>
				<%}%>
              </ul>
            </li>
          </ul>
        </nav><!-- .primary -->
      </div><!-- .grid_12 -->
    </div><!-- .container_12 -->
  </div><!-- .block_nav_primary -->
  <div class="clear"></div>

  <section id="main" class="entire_width">
    <div class="container_12">
       <div class="grid_12">
              <h1 class="page_title">个人信息</h1>
       <table class="cart_product">
	      <tr>
		     <th class="images">用户名字：</th>
		     <th class="bg name"><%=CDP.getC_name() %></th>
		     <th class="edit">手机号码：</th>
		     <th class="bg name"><%=CDP.getC_phone() %></th>
		     <th class="qty">邮箱：</th>
		     <th class="bg name"><%=CDP.getC_email() %></th>
	      </tr>
	      <tr>
		     <td class="images">注册时间：</td>
		     <td class="bg name"><%=CDP.getC_time() %></td>
		     <td class="edit">上一次登录时间：</td>
		     <td class="bg name"><%=session.getAttribute("lasttime") %></td>
		     <td class="qty">上一次修改时间：</td>
		     <td class="bg name"><%=CDP.getLu_time() %></td>
	      </tr>


       </table>
       <h1 class="page_title">订单</h1>
       <table class="cart_product">
	      <tr>
		     <th align="justify" class="images">产品名字</th>
		     <th class="bg name"><b align="justify">订单编号</b></th>
		     <th class="bg name"><b align="justify">下单时间</b></th>
		     <th class="edit">单价</th>
		     <th class="edit"><b align="justify">订单数量</b></th>
		     <th class="edit">订单总额</th>
		     <th class="bg price">发送邮箱</th>
		     <th class="qty">购买方式</th>
		     <th class="bg subtotal">订单状态</th>
	      </tr>
<%
float sum=0,num=0;
if(orderList.size()>0){
		for (int i = 0; i < orderList.size(); i++) {
							Orders ot = (Orders) orderList.get(i);
							num=Integer.valueOf(ot.getP_number()).intValue();
							sum=ot.getP_price()*num;
	%> 
	      <tr>
		     <td class="images"><%=ot.getP_name() %></td>
		     <td class="bg name"><%=ot.getOrder_id() %></td>
		     <td class="bg name"><b style="color: #00F;"><%=ot.getOrder_time() %></b></td>
		     <td class="edit"><%=ot.getP_price() %></td>
		     <td class="edit"><%=ot.getP_number()  %></td>
		      <td class="edit"><b style="color: #F00;"><%=sum %></b></td>
		     <td class="bg price"><%=ot.getOrder_email() %></td>
		     <td class="qty"><%=ot.getOrder_payment() %></td>
		     <td class="bg subtotal">成交</td>
	      </tr>
	<%}}else{ %>
<tr><td colspan="9" align="center" class="images">暂无订单</td></tr>
<%} %>
       </table>
       </div><!-- .grid_12 -->


  <footer>
 <div class="f_info">
      <div class="container_12">
        <div class="grid_6">
          <p class="copyright">BY 417工作室, 2015</p>
        </div><!-- .grid_6 -->

        <div class="grid_6">
          <div class="soc">
 
          </div><!-- .soc -->
        </div><!-- .grid_6 -->

        <div class="clear"></div>
      </div><!-- .container_12 -->
    </div><!-- .f_info -->
  </footer>
  <%}%>
</body>
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
</html>
